#ifndef A_STAR_H
#define A_STAR_H

#include <QVector>
#include <QPointF>
#include <QPair>
#include <queue>
#include <vector>
#include <limits>

// 用于A*算法中的节点定义
struct Node_for_Astar {
    int index;
    double cost;
    QVector<int> path;

    bool operator<(const Node_for_Astar &other) const {
        return cost > other.cost; // 为了让优先队列按升序排列，优先最小的cost
    }
};

class AStarAlgorithm {
public:
    static QPair<double, QVector<int>> aStar(int start, int goal, const QVector<QVector<double>> &distanceMatrix, const QVector<QPointF> &geoVector);

private:
    static double heuristic(const QPointF &a, const QPointF &b);
};

#endif // A_STAR_H
